#include <iostream>
using namespace std;
#include "sys/clock.h"
using namespace tdl;

int us_between_two_nowms = 1000 * 10;

template <typename T>
int get_time(T& c)
{
	msec_t mst1 = c.now_ms();
	::usleep(us_between_two_nowms);
	msec_t mst2 = c.now_ms();
	return mst2 - mst1;
}

int main(int argc, char* argv[])
{
	tdl::thread_clock thc;
	thc.initialize(1);
	while(1)
//	for(int i = 0; i < 10; ++i)
	{
		int m1 = get_time(thc);
		int m2 = get_time(thc);
		cout << "miss_time=" << m1 << ", " << m2 << ", " << abs(m2 - m1) << "ms" << endl;
	}


	return 0;
}

